@extends('content.layouts.default')
@section('content')
<div class="card">
    <div class="card-body">
        <ul class="nav nav-tabs nav-overflow header-tabs">
            <li class="nav-item">
                <a href="{{route('content.slide.index')}}" class="nav-link pb-3 active">
                    幻灯片列表
                </a>
            </li>
            <li class="nav-item">
                <a href="{{route('content.slide.create')}}" class="nav-link pb-3">
                    新增幻灯片
                </a>
            </li>
        </ul>
    </div>

    <div class="card-body ">
        <table class="table">
            <thead>
            <tr >
                <th >编号</th>
                <th >slide标题</th>
                <th>预览图</th>
                <th>slide跳转地址</th>
                <th>上传时间</th>
            </tr>
            </thead>
            <tbody>
            @foreach($slides as $slide)
                {{--dd([$v,$v->category])--}}
                <tr>
                    <td scope="row">{{$slide['id']}}</td>
                    <td>{{$slide['title']}}</td>
                    <td>
                        <div class="avatar-4by3 avatar-lg" >
                            <a href="{{$slide['url']}}" target="_blank">
                                <image src="{{$slide['image']}}" class="avatar-img rounded" ></image>
                            </a>
                        </div>
                    </td>
                    <td>{{$slide['url']}}</td>
                    <td>{{$slide['created_at']->format('Y/m/d')}}</td>
                    <td class="text-right">
                        <div class="btn-group btn-group-sm" role="group" aria-label="First group">
                            <a href="{{route('content.slide.edit',$slide)}}"
                               class="btn btn-light btn-sm">编辑</a>
                            <form action="{{route('content.slide.destroy',$slide)}}" method="post">
                                @csrf
                                @method('DELETE')
                                <button  class="btn btn-sm btn-danger" onclick="confirm('是否删除幻灯片?')">删除</button>
                            </form>
                            <div>
                    </td>
                </tr>
            @endforeach
            </tbody>
        </table>
        {{--通过传递过来的$slides幻灯片对象的links方法实现分页--}}
        {{$slides->links()}}
    </div>
</div>
@endsection
